<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />

<title>classpath.projects</title>
</head>
<body>

<h2><a name="classpath.projects">classpath.projects</a></h2>
<p>
The <code>classpath.projects</code> element produces a FileSet or 
<a href="http://ant.apache.org/manual/CoreTypes/resources.html#collection">Resource Collection</a>
containing all of the projects referenced on the classpath of a project (including the source project).
The projects in the collection will be ordered by least dependency &ndash; i.e. the projects with 
no dependency on other projects will be listed first.
</p>
<p>
The following attributes are supported.
</p>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <th valign="top">Attribute</th>
    <th valign="top">Description</th>
    <th align="center" valign="top">Required</th>
  </tr>
  <tr>
    <td valign="top">exportedonly</td>
    <td valign="top">
    	If false, all classpath entries are included.
    	If true, for dependent projects, only exported classpath entries are included.
    </td>
    <td valign="top" align="center">No; defaults to false.</td>
  </tr>
  <tr>
    <td valign="top">failonerror</td>
    <td valign="top">
    	If false, log a warning message, but do not stop execution if an error occurs.
    	If true, an exception is thrown when an error occurs.
    </td>
    <td valign="top" align="center">No; defaults to true.</td>
  </tr>
  <tr>
    <td valign="top">project</td>
    <td valign="top">Specifies the project whose classpath will be traversed.</td>
    <td valign="top" align="center">
    	No; defaults to the project containing the invoked Ant buildfile.
    </td>
  </tr>
  <tr>
    <td valign="top">includemain</td>
    <td valign="top">
    	If true, the "main" project &ndash; i.e. the project containing the invoked Ant buildfile &ndash;
    	will be included in the Resource Collection. If false, it will be excluded.
    </td>
    <td valign="top" align="center">
    	No; defaults to true.
    </td>
  </tr>
  <tr>
    <td valign="top">usefilepaths</td>
    <td valign="top">
    	If true, a FileSet will be contructed containing FileResources that may be used directly
    	with other Ant tasks, such as <code>&lt;copy&gt;</code> or <code>&lt;sync&gt;</code>. The
    	name of each FileResource will be that of the corresponding native filesytem directory.
    	If false, a Resource Collection will be constructed containing resources that <em>cannot</em>
    	be directly used with Ant tasks that work with FileResources, but which may be useful with
    	other tasks intended for use with Eclipse workspace resources. The name of each resource
    	in the collection will correspond to the name of the project within the Eclipse workspace.
    </td>
    <td valign="top" align="center">
    	No; defaults to true.
    </td>
  </tr>
</table>

<h4>Examples</h4>
<blockquote><pre>
&lt;classpath.projects/&gt;
</pre></blockquote>
<p>Creates a FileSet containing all of the directories corresponding to projects on the classpath
of the project containing the invoked ant buildfile.</p>

<blockquote><pre>
&lt;taskdef resource="net/sf/antcontrib/antlib.xml"/&gt;
...

&lt;task name=&quot;projects.iterate&quot;&gt;
  &lt;pathconvert property=&quot;projects.path&quot;&gt;
    &lt;classpath.projects usefilepaths=&quot;false&quot;/&gt;
  &lt;/pathconvert&gt;

  &lt;foreach list=&quot;${projects.path}&quot; param=&quot;project.name&quot; target=&quot;project.jar&quot; delimiter=&quot;:&quot;/&gt;
&lt;/task&gt;

&lt;task name=&quot;project.jar&quot;&gt;
  &lt;jar destfile=&quot;${dist}/lib/${project.name}.jar&quot;&gt;
    &lt;classpath.files project=&quot;${project.name}&quot; traverse=&quot;false&quot;&gt;
      &lt;select kind=&quot;output&quot;/&gt;
    &lt;/classpath.files&gt;
  &lt;/jar&gt;
&lt;/task&gt;

</pre></blockquote>
<p>This example uses the 
<a href="http://ant-contrib.sourceforge.net/tasks/tasks/foreach.html"><code>&lt;foreach&gt;</code></a> task
from the <a href="http://ant-contrib.sourceforge.net/">Ant-Contrib</a> project to iterate the list of projects.
This will create a list of the projects on the classpath, set the property <code>projects.path</code> with a path
string containing the list of project names, and iterate the list calling the <code>project.jar</code> task
for each project passing the project name as the value of the <code>project.name</code> property. The
<code>project.jar</code> task will then create a JAR with the output resources for each project in
the "lib" subfolder of the directory specified by the <code>dist</code> property.
</p>
<p><em>Note:</em>
To use an external library such as <a href="http://ant-contrib.sourceforge.net/">Ant-Contrib</a> in the ant build, 
the necessary JARs must be added to the classpath in the 
<a href="PLUGINS_ROOT/org.eclipse.platform.doc.user/gettingStarted/qs-84_run_ant.htm">launch configuration</a>
dialog for the Ant buildfile, or in the 
<a href="PLUGINS_ROOT/org.eclipse.platform.doc.user/reference/ref-antruntimeprefs.htm">Ant Runtime preferences</a>.
</p>


</body>
</html>